home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGASIC
/
BASFILES.LZH
/
DIALOG2.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-10
|
4KB
|
158 lines
'$INCLUDE:'QBTOOLS.INC'
'' '$INCLUDE: 'QBTOOLS2.INC'
'DIM Ques$(10)
'Ques$(1) = "This is a test to see how the"
'Ques$(2) = "dialog box works. The next line is the input."
'Ques$(3) = "It is important to see how this follows on from the"
'Ques$(4) = "input. Both these lines, and those before hand"
'Ques$(5) = "should be left justified."
'Ques$(6) = "Heres More"
'Ques$(7) = "Heres More again"
'Ques$(8) = "After"
'First% = 2
'Second% = 3
'Third% = 3
'
'sect% = 1
'
'Ffgd% = 7
'Fbgd% = 0
'Gfgd% = 7
'Gbgd% = 0
'
'Length1% = 22
'Length2% = 17
'
'FOR sect% = 0 TO 2
' DoubleDialog Ques$(), First%, Second%, Third%, Length1%, Length2%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Ek%
'NEXT sect%
'
'END
SUB DoubleDialog (Ques$(), First%, second%, Third%, Length1%, Length2%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Ek%)
' First - Textlines before the first question
' Second - Textlines between the two questions
' Third - Textlines after the second question
' Length1 - Length of input #1
' Length2 - Length of input #2
' Ffgd - Frame foreground
' Fbgd - Frame background
' Gfgd - General Foreground
' Gbgd - General background
' Sect - Section of the screen to display on
' 0=Top,1=Center,2=Bottom
' Answer1 - Answer string #1
' Answer2 - Answer string #2
' Ek - Exit Key
' 5=Return, 7=ESC
'$DYNAMIC
REDIM Saver%(2000)
BandA% = First% + second% + Third%
height% = BandA% ' Pure Text height
height% = height% + 8 ' 6 lines of drawing + 2 input lines
IF height% > 25 THEN
EXIT SUB
END IF
IF Length1% < 1 THEN
EXIT SUB
END IF
IF Length2% < 1 THEN
EXIT SUB
END IF
SELECT CASE sect%
CASE 0
Begin% = 1
CASE 1
Begin% = (25 - height%) / 2
CASE 2
Begin% = (25 - height%) + 1
CASE ELSE
EXIT SUB
END SELECT
SaveScreen Saver%(1)
Txwd% = Length1%
IF Length2% > Txwd% THEN
Txwd% = Length2%
END IF
FOR j% = 1 TO BandA%
Trim Ques$(j%)
IF LEN(Ques$(j%)) > Txwd% THEN
Txwd% = LEN(Ques$(j%))
END IF
NEXT j%
BoxWidth% = Txwd% + 4
LeftCol% = (80 - BoxWidth%) / 2
Wid% = BoxWidth%
FrameType% = 3
FrmFgd% = Ffgd%
FrmBgd% = Fbgd%
Fill% = 1
FillFgd% = Gfgd%
FillBgd% = Gbgd%
DrawBox Begin%, LeftCol%, Wid%, height%, FrameType%, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
Attrib1% = Attributes%(Gfgd%, Gbgd%, 0, 0)
Attrib2% = Attributes%(Ffgd%, Fbgd%, 0, 0)
FOR j% = 1 TO First%
text$ = Ques$(j%)
ColorPrint text$, Begin% + j%, LeftCol% + 2, Attrib1%
NEXT j%
FOR j% = 1 TO second%
text$ = Ques$(j% + First%)
ColorPrint text$, Begin% + First% + 3 + j%, LeftCol% + 2, Attrib1%
NEXT j%
FOR j% = 1 TO Third%
text$ = Ques$(j% + First% + second%)
ColorPrint text$, Begin% + First% + second% + 6 + j%, LeftCol% + 2, Attrib1%
NEXT j%
Istart1% = (80 - Length1%) / 2
Istart2% = (80 - Length2%) / 2
DrawBox Begin% + First% + 1, Istart1% - 1, Length1% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
DrawBox Begin% + First% + second% + 4, Istart2% - 1, Length2% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
DO
Xc% = LeftCol% + 2
Yc% = Begin% + First% + 2
TextInput 0, 0, 0, 0, 1, 1, 1, Length1%, Answer1$, Istart1%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
IF Ek% <> 6 THEN
EXIT DO
END IF
Xc% = LeftCol% + 2
Yc% = Begin% + First% + second% + 5
TextInput 0, 0, 0, 0, 1, 1, 1, Length2%, Answer2$, Istart2%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
IF Ek% <> 6 THEN
EXIT DO
END IF
LOOP
RestoreScreen Saver%(1)
END SUB